package com.leilei.join.interval;

import com.leilei.join.common.VehicleInfo;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.api.java.tuple.Tuple4;
import org.apache.flink.streaming.api.functions.co.ProcessJoinFunction;
import org.apache.flink.util.Collector;

/**
 * @author lei
 * @version 1.0
 * @date 2021/3/27 22:03
 * @desc 车辆Join 车辆类型
 */
public class VehicleJoinTypeProcessFunction extends ProcessJoinFunction<VehicleInfo,
        Tuple2<Integer, String>,
        Tuple4<Integer, String, Integer, String>> {
    @Override
    public void processElement(VehicleInfo left, Tuple2<Integer, String> right, Context ctx,
                               Collector<Tuple4<Integer, String, Integer, String>> out) throws Exception {
        out.collect(Tuple4.of(left.getVehicleId(),right.f1,left.getCreateTime(),left.getColor()));
    }
}
